From 0cf95c471d779cd3d4da661d31d53ec215e66d44 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20H=C3=A4rdeman?= Date: Wed, 24 Sep 2025 15:00:57 +0200 Subject: [PATCH] dhcpv4: move and rename handle_dhcpv4() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Move handle_dhcpv4() below the function it calls (dhcpv4_handle_msg()) and rename it to dhcpv4_handle_dgram() for consistency with other function names. Signed-off-by: David Härdeman Link: https://github.com/openwrt/odhcpd/pull/264 Signed-off-by: Álvaro Fernández Rojas --- src/dhcpv4.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/dhcpv4.c b/src/dhcpv4.c index b63104c..f52d815 100644 --- a/src/dhcpv4.c +++ b/src/dhcpv4.c @@ -325,15 +325,6 @@ static int dhcpv4_send_reply(const void *buf, size_t len, return sendto(*sock, buf, len, MSG_DONTWAIT, dest, dest_len); } -/* Handler for DHCPv4 messages */ -static void handle_dhcpv4(void *addr, void *data, size_t len, - struct interface *iface, _unused void *dest_addr) -{ - int sock = iface->dhcpv4_event.uloop.fd; - - dhcpv4_handle_msg(addr, data, len, iface, dest_addr, dhcpv4_send_reply, &sock); -} - /* DNR */ struct dhcpv4_dnr { uint16_t len; @@ -726,6 +717,15 @@ void dhcpv4_handle_msg(void *addr, void *data, size_t len, #endif } +/* Handler for DHCPv4 messages */ +static void dhcpv4_handle_dgram(void *addr, void *data, size_t len, + struct interface *iface, _unused void *dest_addr) +{ + int sock = iface->dhcpv4_event.uloop.fd; + + dhcpv4_handle_msg(addr, data, len, iface, dest_addr, dhcpv4_send_reply, &sock); +} + static bool dhcpv4_insert_assignment(struct list_head *list, struct dhcp_assignment *a, uint32_t addr) { @@ -1138,7 +1138,7 @@ int dhcpv4_setup_interface(struct interface *iface, bool enable) goto out; } - iface->dhcpv4_event.handle_dgram = handle_dhcpv4; + iface->dhcpv4_event.handle_dgram = dhcpv4_handle_dgram; odhcpd_register(&iface->dhcpv4_event); } else { while (!list_empty(&iface->dhcpv4_assignments)) -- 2.30.2